<?php
	
	$guid=get_input("lang");
	$entity = get_entity($guid);
	$url=$vars['url'];
	$validation=elgg_view_comments($entity);
	
	if($entity->getOwner()==$_SESSION['user']->guid){
	  $editer="<a href=\"".$vars['url']."mod/pel/editlang.php?guid=$guid\"><img src=\"".$vars['url']."mod/pel/graphics/iconEdit.gif\" />".elgg_echo('pel:editlang')."</a>";
	  $supprimer="<a href=\"".$vars['url']."mod/pel/deletelang.php?guid=$guid\"><img src=\"".$vars['url']."mod/pel/graphics/iconDelete.gif\" />".elgg_echo('pel:deletelang')."</a>";
		$avis=elgg_view("editmenu",array('entity' => $entity));
	}
	else{
	  $editer="";
	  $supprimer="";
	}

	$lang = $entity->description;
  $langtravel=$entity->travel;
  $langtraveldate=$entity->traveldate;
  $langtraining=$entity->training;
  $langtrainingdate=$entity->trainingdate;
  $langmedia=$entity->media;
  $langcertificat=$entity->certificat;
  $langorganisme=$entity->organisme;
  $langnote=$entity->note;
  $langdate=$entity->date;
  $ecoutervar=$entity->ecouter;
  $lirevar=$entity->lire;
  $conversationvar=$entity->conversation;
  $exprimervar=$entity->expression;
  $ecrirevar=$entity->ecrire;
  //$file_upload=$entity->file;
  //$file_path=$entity->file_path;

	if($langmedia=="")
		$tabmedia="<li><dt>Aucun</li>";
	else
		$tabmedia="<li><dt>$langmedia</li>";

  if(is_array($langcertificat)){
    foreach ($langcertificat as $k => $v){
      $tabcertificat.="<tr><td>$langcertificat[$k]</td><td>$langorganisme[$k]</td><td>$langnote[$k]</td><td>$langdate[$k]</td></tr>";
    }
  }
  else
  	$tabcertificat="<tr><td>$langcertificat</td><td>$langorganisme</td><td>$langnote</td><td>$langdate</td></tr>";


	if($langtravel=="")
		$tabtravel="<li><dt>Aucune<br/></li>";
  else if(is_array($langtravel)){
    foreach ($langtravel as $t => $v){
      $tabtravel.="<li><dt>$langtraveldate[$t]<dd>$langtravel[$t]<br/></li>";
    }
  }
  else
    $tabtravel="<li><dt>$langtraveldate  $langtravel<br/></li>";
      
	if($langtraining=="")
		$tabtraining="<li><dt>Aucune<br/></li>";
  else if(is_array($langtraining)){
    foreach ($langtraining as $r => $v){
      $tabtraining.="<li><dt>$langtrainingdate[$r]<dd>$langtraining[$r]<br/></li>";
    }
  }
  else
    $tabtraining.="<li><dt>$langtrainingdate<dd>$langtraining<br/></li>";
	
  $title_label = elgg_echo('pel:otherlang2');
  $autoEval = elgg_echo('pel:autoeval');
  $medias = elgg_echo('pel:medias');
  $formation = elgg_echo('pel:formation');
  $bio = elgg_echo('pel:bio');
  $dir = elgg_echo('pel:dir');
  $travel = elgg_echo('pel:travel');
  $training = elgg_echo('pel:training');
  $media = elgg_echo('pel:media');
 // $file = elgg_echo('pel:file');
  $certificat = elgg_echo('pel:certificatresultat');
  $nom = elgg_echo('pel:nom');
  $organisme = elgg_echo('pel:organisme');
  $note = elgg_echo('pel:note');
  $date= elgg_echo('pel:date');
  $experience =elgg_echo('pel:experience');
  $ecouter=elgg_echo('pel:ecouter');
  $lire=elgg_echo('pel:lire');
  $conversation=elgg_echo('pel:conversation');
  $exprimer= elgg_echo('pel:exprimer');
  $ecrire= elgg_echo('pel:ecrire');
  $parler=elgg_echo('pel:parler');
  $comprendre=elgg_echo('pel:comprendre');
  
  if ($ecoutervar=="A1")
  	$ecouterresultat="a1";
  else if ($ecoutervar=="A2")
  	$ecouterresultat="a2";
  else if ($ecoutervar=="B1")
  	$ecouterresultat="b1";
  else if ($ecoutervar=="B2")
  	$ecouterresultat="b2";
  else if ($ecoutervar=="C1")
  	$ecouterresultat="c1";
  else if ($ecoutervar=="C2")
  	$ecouterresultat="c2";
  else if ($ecoutervar=="")
  	$ecouterresultat="vide";
  
  if ($lirevar=="A1")
  	$lireresultat="a1";
  else if ($lirevar=="A2")
  	$lireresultat="a2";
  else if ($lirevar=="B1")
  	$lireresultat="b1";
  else if ($lirevar=="B2")
  	$lireresultat="b2";
  else if ($lirevar=="C1")
  	$lireresultat="c1";
  else if ($lirevar=="C2")
  	$lireresultat="c2";
  else if ($lirevar=="")
  	$lireresultat="vide";
  
 	if ($conversationvar=="A1")
  	$conversationresultat="a1";
  else if ($conversationvar=="A2")
  	$conversationresultat="a2";
  else if ($conversationvar=="B1")
  	$conversationresultat="b1";
  else if ($conversationvar=="B2")
  	$conversationresultat="b2";
  else if ($conversationvar=="C1")
  	$conversationresultat="c1";
  else if ($conversationvar=="C2")
  	$conversationresultat="c2";
  else if ($conversationvar=="")
  	$conversationresultat="vide";
  
  if ($exprimervar=="A1")
  	$exprimerresultat="a1";
  else if ($exprimervar=="A2")
  	$exprimerresultat="a2";
  else if ($exprimervar=="B1")
  	$exprimerresultat="b1";
  else if ($exprimervar=="B2")
  	$exprimerresultat="b2";
  else if ($exprimervar=="C1")
  	$exprimerresultat="c1";
  else if ($exprimervar=="C2")
  	$exprimerresultat="c2";
  else if ($exprimervar=="")
  	$exprimerresultat="vide";
  
 	if ($ecrirevar=="A1")
  	$ecrireresultat="a1";
  else if ($ecrirevar=="A2")
  	$ecrireresultat="a2";
  else if ($ecrirevar=="B1")
  	$ecrireresultat="b1";
  else if ($ecrirevar=="B2")
  	$ecrireresultat="b2";
  else if ($ecrirevar=="C1")
  	$ecrireresultat="c1";
  else if ($ecrirevar=="C2")
  	$ecrireresultat="c2";
  else if ($ecrirevar=="")
  	$ecrireresultat="vide";
		
	$ecriretext=elgg_echo("pel:tabecrire".ucfirst($ecrireresultat));
	$exprimertext=elgg_echo("pel:tabexprimer".ucfirst($exprimerresultat));
	$ecoutertext=elgg_echo("pel:tabecouter".ucfirst($ecouterresultat));
	$conversationtext=elgg_echo("pel:tabconversation".ucfirst($conversationresultat));
	$liretext=elgg_echo("pel:tablire".ucfirst($lireresultat));

$form_body = <<<EOT
	<div id="langview">
  <p>
    $editer
    $supprimer
		$avis
    <h4>$comprendre</h4>
    <table class="competence">
      <tr>
        <td><img src="$url/mod/pel/graphics/ecouter.gif" alt="ecouter"/></td>
        <th scope="row">$ecouter</th>
        <td><a class="tooltip" href="#" title="$ecoutertext"><img src="$url/mod/pel/graphics/$ecouterresultat.gif" alt="ecouter"/></a></td>
      </tr>
      <tr>
        <td><img src="$url/mod/pel/graphics/lire.gif" alt="lire"/></td>
        <th scope="row">$lire</th>
        <td><a class="tooltip" href="#" title="$liretext"><img src="$url/mod/pel/graphics/$lireresultat.gif" alt="lire"/></a></td>
      </tr>
        <th><h4>$parler</h4></th>
      <tr>
        <td><img src="$url/mod/pel/graphics/ppconv.gif" alt="conversation"/></td>
        <th scope="row">$conversation</th>
        <td><a class="tooltip" href="#" title="$conversationtext"><img src="$url/mod/pel/graphics/$conversationresultat.gif" alt="conversation"/></a></td>
      </tr>
      <tr>
        <td><img src="$url/mod/pel/graphics/exp_oral_continu.gif" alt="exprimer"/></td>
        <th scope="row">$exprimer</th>
        <td><a class="tooltip" href="#" title="$exprimertext"><img src="$url/mod/pel/graphics/$exprimerresultat.gif" alt="exprimer"/></a></td>
      </tr>
        <th><h4>$ecrire</h4></th>
      <tr>
        <td><img src="$url/mod/pel/graphics/ecrire.gif" alt="ecrire"/></td>
        <th scope="row">$ecrire</th>
        <td><a class="tooltip" href="#" title="$ecriretext"><img src="$url/mod/pel/graphics/$ecrireresultat.gif" alt="ecrire"/></a></td>
      </tr>
    </table>
  </p>
  <div class="information">
  	<p>
      <h4>$certificat</h4>
      <table class="certificat">
        <tr>
          <th class="grand">$nom</th>
          <th class="grand">$organisme</th>
          <th class="petit">$note</th>
          <th class="petit">$date</th>
        </tr> 
          $tabcertificat
      </table>
	  </p>
	  <p>
	    <h4>$experience</h4>
      <dl>
        $tabtravel
      </dl>
	    <h4>$formation</h4>
      <dl>
        $tabtraining
      </dl>
	    <h4>$medias</h4>
      <dl>
        $tabmedia
      </dl>  
	  </p>
	</div>
	</div>

EOT;
/*
   <div>
            <label>$file</label>
            <p><a href="$CONFIG->dataroot.$file_upload">$file_upload</a></p>
            </div>
*/
	echo $form_body;
	echo $validation;
?>